﻿
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using gfLibrary;
using DBUtility;
using Model;
using BLL;

namespace GreatGF
{
    public partial class CALIB_LOG_Insert_Update : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                string strMode = Request["m"];

                if((strMode == "u")||(strMode == "b")||(strMode == "r"))
                {
                    string strId = Request["UniqueKey"];

                    CALIB_LOG_BLL m_CALIB_LOG_BLL = new CALIB_LOG_BLL();

                    if(m_CALIB_LOG_BLL.Exists(Convert.ToInt32(strId)) == true)
                    {
                        CALIB_LOG m_CALIB_LOG = new CALIB_LOG();
                        m_CALIB_LOG = m_CALIB_LOG_BLL.GetModel(Convert.ToInt32(strId));

                        txtID.Text = m_CALIB_LOG.ID.ToString();
                        txtJCXH.Text = m_CALIB_LOG.JCXH;
                        txtCalibName.Text = m_CALIB_LOG.CalibName;
                        txtStartTime.Text = m_CALIB_LOG.StartTime;
                        txtEndTime.Text = m_CALIB_LOG.EndTime;
                        txtDetailedData.Text = m_CALIB_LOG.DetailedData;
                    }
                    else
                    {
                        gfAjaxJs.SetAlertMsg(this.UpdatePanel1, "请选择一条记录！");
                        gfAjaxJs.SetGoToUrl(this.UpdatePanel1, "CALIB_LOG_List.aspx");
                    }

                    if((strMode == "b")||(strMode == "r"))
                    {
                        txtID.ReadOnly = true;
                        txtID.CssClass = "csstextboxreadonly";
                        txtJCXH.ReadOnly = true;
                        txtJCXH.CssClass = "csstextboxreadonly";
                        txtCalibName.ReadOnly = true;
                        txtCalibName.CssClass = "csstextboxreadonly";
                        txtStartTime.ReadOnly = true;
                        txtStartTime.CssClass = "csstextboxreadonly";
                        txtEndTime.ReadOnly = true;
                        txtEndTime.CssClass = "csstextboxreadonly";
                        txtDetailedData.ReadOnly = true;
                        txtDetailedData.CssClass = "csstextboxreadonly";
                    }

                }
                if (strMode == "b" || strMode == "r")
                {
                    lblOperateType.Text = "查看";
                }
            }

            btnBack.Attributes["onclick"] = "javascript:window.location.href='CALIB_LOG_List.aspx';return false;";
        }
    }
}
